|
STEP 6: Embedding a Mute Button
|
It is not always necessary for a Beatnik Player to actually be playing music. When the control panel is set in SYSTEM display, then the mute button that appears in the top right corner will affect the Beatnik Player's global audio output. This includes all other player instances, regardless of whether or not they are even in the same document or window as the instance with the mute button.
In this example, we have used this principle to our advantage by embedding one player instance that serves purely as a common global mute button and does nothing more. Try playing some of the files embedded below by using the transport controls. Then, click on the mute button. You will notice that the music you started playing now becomes silent, and the mute button changes state to indicate that the Beatnik Player's global audio output has been muted. Now, if you click on the mute button a second time the global mute will once again be turned off, the mute button graphic will return to its original unmuted state, and the music will continue playing. Each time you click on the mute button the global mute state will toggle.
| "Ambient" by Brian Salter | |
| "Classical" arranged by Brian Salter | |
| "Jungle" by Brian Salter | |
| "Lounge" by Brian Salter | |
| "Modern Rock" by Paul Sebastien |
To drive home the point that the mute button affects the global audio output of the Beatnik Player, try playing several of the files simultaneously before clicking on the mute button. Sure, you'll have to endure a moment's cacophony, but it will be perfectly clear when you click the mute button that it is affecting the combined audio output of all Beatnik Player instances.
Now, for each of the player control panels, pop up the player's contextual menu and select the
Now, let's take a look at the source code for this example. The text that is highlighted indicates the code that is responsible for displaying the mute button. The rest of the code is resposible for embedding the other player instances that appear inside the table layout in the form of slim transport controls.
<CENTER>
<TABLE BORDER=4 CELLSPACING=0 CELLPADDING=0>
<TR><TD><EMBED
SRC="stub.rmf"
TYPE="audio/rmf"
WIDTH=40
HEIGHT=15
DISPLAY=SYSTEM
AUTOSTART=FALSE
LOOP=FALSE
PLUGINSPAGE="http://www.beatnik.com/to/?player"
></TD></TR>
</TABLE>
<BR>
<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=6>
<TR BGCOLOR=EEEEEE>
<TD>
"<B>Ambient</B>" by Brian Salter
</TD>
<TD>
<EMBED
SRC="ambient.rmf"
TYPE="audio/rmf"
WIDTH=144
HEIGHT=15
DISPLAY=SONG
AUTOSTART=FALSE
LOOP=FALSE
PLUGINSPAGE="http://www.beatnik.com/to/?player"
>
</TD>
</TR>
<TR BGCOLOR=DDDDDD>
<TD>
"<B>Classical</B>" arranged by Brian Salter
</TD>
<TD>
<EMBED
SRC="classical.rmf"
TYPE="audio/rmf"
WIDTH=144
HEIGHT=15
DISPLAY=SONG
AUTOSTART=FALSE
LOOP=FALSE
PLUGINSPAGE="http://www.beatnik.com/to/?player"
>
</TD>
</TR>
<TR BGCOLOR=CCCCCC>
<TD>
"<B>Jungle</B>" by Brian Salter
</TD>
<TD>
<EMBED
SRC="jungle.rmf"
TYPE="audio/rmf"
WIDTH=144
HEIGHT=15
DISPLAY=SONG
AUTOSTART=FALSE
LOOP=FALSE
PLUGINSPAGE="http://www.beatnik.com/to/?player"
>
</TD>
</TR>
<TR BGCOLOR=BBBBBB>
<TD>
"<B>Lounge</B>" by Brian Salter
</TD>
<TD>
<EMBED
SRC="lounge.rmf"
TYPE="audio/rmf"
WIDTH=144
HEIGHT=15
DISPLAY=SONG
AUTOSTART=FALSE
LOOP=FALSE
PLUGINSPAGE="http://www.beatnik.com/to/?player"
>
</TD>
</TR>
<TR BGCOLOR=AAAAAA>
<TD>
"<B>Modern Rock</B>" by Paul Sebastien
</TD>
<TD>
<EMBED
SRC="modern-rock.rmf"
TYPE="audio/rmf"
WIDTH=144
HEIGHT=15
DISPLAY=SONG
AUTOSTART=FALSE
LOOP=FALSE
PLUGINSPAGE="http://www.beatnik.com/to/?player"
>
</TD>
</TR>
</TABLE>
</CENTER>
|
In order to make the control panel only as big as the mute button, we first set the HEIGHT to 15 so that the control panel only displays the slim top portion. We then take advantage of a subtle little behavior of the control panel. That is, when the WIDTH is set to less than 144, the mute button of the control panel is always drawn against the right-hand side. So, while a WIDTH of 40 does not give the control panel enough room to display both the Beatnik symbol and the mute button that usually appear in the top portion of the SYSTEM display, it still gives the control panel enough room to display at least the mute button.
In order to illustrate this principle better, take a look at the control panels below where the WIDTH is progressively decreased, starting from 144 and ending at 41. At a WIDTH of 41, you can still see a tiny smidgen of the Beatnik "B" peeping through with player versions earlier than 2.1. But, with Beatnik Player versions 2.1 and higher, the mute button is clean.
With Beatnik Player versions earlier than 2.1, the mute button is shown as a speaker icon that becomes grayed out when the Beatnik Player's global audio output is muted. With versions 2.1 and higher, the mute button is shown as a pair of green and red on-off lights, where the red light is lit when the audio is muted and the green light is lit when the audio is not muted. With both styles of mute buttons, clicking anywhere on the mute button has the effects of toggling the global audio output's mute state.
The following table shows the different styles of mute button used in different versions of the Beatnik Player...
|